<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8">
		<title>Wireframe</title>
		<link rel="stylesheet" href="<?php echo site_url("jqueryui/css/ui-lightness/jquery-ui-1.8.18.custom.css") ?>" type="text/css">
		<link rel="stylesheet" href="<?php echo site_url("bootstrap/css/bootstrap.css") ?>" type="text/css">
		<link rel="stylesheet" href="<?php echo site_url("datatables/media/css/jquery.dataTables.css") ?>" type="text/css">
		<script type="text/javascript" language="javascript" src="<?php echo site_url("jquery/jquery-1.7.1.min.js") ?>"></script>
		<script type="text/javascript" language="javascript" src="<?php echo site_url("bootstrap/js/bootstrap.js") ?>"></script>
		<script type="text/javascript" language="javascript" src="<?php echo site_url("datatables/media/js/jquery.dataTables.min.js") ?>"></script>
		<script type="text/javascript" charset="utf-8">
			$(document).ready(function()
			{			
				$('#bill-table').dataTable({
					"fnDrawCallback": function ( oSettings ) {
							if ( oSettings.aiDisplay.length == 0 )
							{
								return;
							}
							
							var nTrs = $('tbody tr', oSettings.nTable);
							var iColspan = nTrs[0].getElementsByTagName('td').length;
							var sLastGroup = "";
							for ( var i=0 ; i<nTrs.length ; i++ )
							{
								var iDisplayIndex = oSettings._iDisplayStart + i;
								var sGroup = oSettings.aoData[ oSettings.aiDisplay[iDisplayIndex] ]._aData[0];
								if ( sGroup != sLastGroup )
								{
									var nGroup = document.createElement( 'tr' );
									var nCell = document.createElement( 'td' );
									nCell.colSpan = iColspan;
									nCell.className = "group";
									nCell.innerHTML = sGroup;
									nGroup.appendChild( nCell );
									nTrs[i].parentNode.insertBefore( nGroup, nTrs[i] );
									sLastGroup = sGroup;
								}
							}
						},
						"aoColumnDefs": [
							{ "bVisible": false, "aTargets": [ 0 ] },
							{ "bSortable": false, "aTargets": [ 3 ]}
						],
						"aaSortingFixed": [[ 0, 'asc' ]],
						"aaSorting": [[ 1, 'asc' ]],
						"sDom": 'lfr<"giveHeight"t>ip',
						"bProcessing": true,
						"bServerSide": true,
						"sAjaxSource": "<?php echo site_url('bills/getbills') ?>",
						"fnServerData" : function (sSource, aoData, fnCallback)
						{
							$.ajax(
							{
								"dataType": "json",
								"type": "POST",
								"url": sSource,
								"data": aoData,
								"success": fnCallback
							});
						}
				});
			});
		</script>
	</head>
	<body>
		<?php $this->load->view('v_navbar'); ?>
		<div class="container">
			<div class="row">
				<div class="span12 ui-corner-all">
					<div class="well">
						<h1>Your Bills</h1>
						<table id="bill-table">
							<thead>
								<tr>
									<th>Vendor</th>
									<th>Date Due</th>]
									<th>Amount</th>
									<th>Description</th>
									<th>Status</th>
									<th></th>
								</tr>
							</thead>
							<tbody>
							</tbody>
						</table>
					</div>
				</div>
			</div>
		</div>
	</body>
</html>